package com.sunnada.edu.business.attendance.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sunnada.edu.system.pub.dao.BaseDaoImpl;

@Repository
public class AttenRecordDaoImpl extends BaseDaoImpl implements AttenRecordDao {

	@Override
	public int getAttenRecordCots(HashMap<String, String> params) {
		List list = selectList("attenRecord_sqlmap.getAttenRecordCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> findAttenRecord(HashMap<String, String> params) {
		return selectList("attenRecord_sqlmap.findAttenRecord", params);
	}

	@Override
	public int attendanceDelete(HashMap<String, String> params) {
		return delete("attenRecord_sqlmap.attendanceDelete", params);
	}

	@Override
	public int attenRecordAdd(HashMap<String, String> params) {
		return insert("attenRecord_sqlmap.attenRecordAdd", params);
	}

	@Override
	public int attenRecordDataUpdate(HashMap<String, String> params) {
		return update("attenRecord_sqlmap.attenRecordDataUpdate", params);
	}
	
	@Override
	public int attenRecordUpdate(HashMap<String, String> params) {
		return update("attenRecord_sqlmap.attenRecordUpdate", params);
	}

	@Override
	public List<?> getAttenRecordData(HashMap<String, String> params) {
		List<?> list = selectList("attenRecord_sqlmap.getAttenRecordData", params);
		
		return list;
	}
	
	@Override
	public List<?> exportAttendance(HashMap<String, String> params) {
		return selectList("attenRecord_sqlmap.exportAttendance", params);
	}
	
	@Override
	public int getAttenRecordsCots(HashMap<String, String> params) {
		List list = selectList("attenRecord_sqlmap.getAttenRecordsCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> findAttenRecords(HashMap<String, String> params) {
		return selectList("attenRecord_sqlmap.findAttenRecords", params);
	}

}
